package hotel.service.impl;

import java.util.List;
import hotel.service.IBedTypeService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import common.dao.BedTypeDAO;
import common.pojo.BedType;


@Scope("prototype")
@Service
public class BedTypeService implements IBedTypeService {
	@Autowired
	private BedTypeDAO bedTypedao;
	
	public List<BedType> find(){
		return bedTypedao.find();
	}

	public List<BedType> find(int start, int limit,
			String orderbys, String desc) {
		return bedTypedao.findList(start, limit, orderbys, desc);
	}
	
	public int getCount(){
		return bedTypedao.getCount();
	}

	public boolean save(BedType bedType) {
		bedTypedao.save(bedType); 
		return true;
	}
	
	public BedType findInfoById(int id){
		return bedTypedao.findInfoById(id);
	}

	public boolean update(BedType bedType) {
		
		return bedTypedao.update(bedType);
	}

	public boolean delete(String ids) {
		String[] id = StringUtils.split(ids, ",");
		for(int i=0;i<id.length;i++){
			bedTypedao.delete(Integer.valueOf(id[i]));
		}
		return true;
	}
	public boolean update(String[] ids, String[] sorts) {
		// TODO Auto-generated method stub
		for(int i=0;i<ids.length;i++)
		{
			bedTypedao.update("update bedType set sort="+sorts[i]+"where id="+ids[i]);
		}
		return true;
	}

	public List<BedType> getHotelBrandList() {
		// TODO Auto-generated method stub
		return null;
	}

	public List<BedType> getHotelBrandListByPage(int start, int limit,
			String orderbys, String desc) {
		// TODO Auto-generated method stub
		return null;
	}

	public boolean update(String ids) {
		// TODO Auto-generated method stub
		return false;
	}
}
